<template>
  <div class="aaa">
        <el-container>
          <el-header>积分商城品类管理</el-header>
          <el-container style="height: 580px; border: 1px solid #eee">
            <el-aside width="200px" style="background-color: rgb(238, 241, 246)">
              <el-menu>
                <el-submenu v-if="this.ccc" index="5">
                  <template  slot="title"><i class="el-icon-menu"></i>账号管理</template>
                    <a  @click.prevent="admin" href="#"><el-menu-item index="1-4-1">账号管理</el-menu-item></a>
                </el-submenu>
                <el-submenu index="1">
                  <template slot="title"><i class="el-icon-menu"></i>废品类别</template>
                    <a  @click.prevent="month" href="#"><el-menu-item index="1-4-1">销量统计</el-menu-item></a>
                     <a  @click.prevent="type" href="#"><el-menu-item index="1-4-1">废品类别管理</el-menu-item></a>
                </el-submenu>
                <el-submenu index="2">
                  <template slot="title"><i class="el-icon-menu"></i>积分商城管理</template>
                    <a  @click.prevent="goodsType" href="#"><el-menu-item index="1-4-1">积分商城类别管理</el-menu-item></a>
                    <a  @click.prevent="goods" href="#"><el-menu-item index="1-4-1">积分商品管理</el-menu-item></a>
                    <a  @click.prevent="order" href="#"><el-menu-item index="1-4-1">积分商品订单</el-menu-item></a>

                </el-submenu>
                <el-submenu index="3">
                <template slot="title"><i class="el-icon-menu"></i>站点管理</template>
                    <a  @click.prevent="selectSiteInfo" href="#"><el-menu-item index="2-4-1">站点信息</el-menu-item></a>
                    <a  @click.prevent="selectSiteAccount" href="#"><el-menu-item index="2-4-2">站点账号</el-menu-item></a>
                    <!-- <a  @click.prevent="selectSiteStorage" href="#"><el-menu-item index="2-4-3">库存统计</el-menu-item></a> -->
                </el-submenu>
                <el-submenu index="4">
                <template slot="title"><i class="el-icon-menu"></i>回收员管理</template>
                    <a  @click.prevent="selectRecycleInfo" href="#"><el-menu-item index="3-4-1">回收员信息</el-menu-item></a>              </el-submenu>
                <el-submenu index="9">
    <!--              <template slot="title"><i class="el-icon-menu"></i><a  @click.prevent="logout" href="#">退出登录</a></template>
     -->            </el-submenu>
              </el-menu>
            </el-aside>
            <el-main>
              <router-view />
            </el-main>
          </el-container>
        </el-container>

  </div>
</template>

<script>

    export default {
      data() {
        return {
            a:{
             adminId:"",
             name:"",
             role:""
            },
            ccc:false
        }
      },
      methods: {

        // 退出登录
        logout(){
          this.$http.post("/shopAccount/logout").then(resp=>{
            localStorage.removeItem("loging")
            this.loginUser = JSON.parse(localStorage.getItem("loginUser"))
            this.$router.push("/")
          })
        },
        admin(){
          this.$router.push("/admin").catch(error => {})

        },

        type(){
          this.$router.push("/type").catch(error => {})

        },
        month() {
          this.$router.push("/month").catch(error => {})

        },
        goods() { //积分商品
          this.$router.push("/goods").catch(error => {})
        },
        // 商品类别管理
        goodsType() {
          this.$router.push("/goodsType").catch(error => {})
        },
        // 商品类别管理
        goodsType(){
          this.$router.push("/goodsType").catch(error=>{})
        },
        // 站点信息
        selectSiteInfo(){
          this.$router.push("/selectSiteInfo").catch(error=>{})
        },
        // 站点账号信息
        selectSiteAccount(){
          this.$router.push("/selectSiteAccount").catch(error=>{})
        },
        // 回收员信息
        selectRecycleInfo(){
          this.$router.push("/selectRecycleInfo").catch(error=>{})
        },
        // 站点入库信息
        // selectSiteStorage(){
        //   this.$router.push("/selectSiteStorage").catch(error=>{})
        // },
        order(){
          this.$router.push("/order").catch(error=>{})

        },
        abc(){
          this.a.role  =localStorage.getItem("adminToken")

          if(this.a.role=='"超管"'){

            this.ccc=true
          }

        }

      },
      created() {
        this.abc()


      }
    }
</script>

<style>

 .el-header,.el-footer {
     background-color: #B3C0D1;
     color: #333;
     text-align: center;
     line-height: 60px;
   }

   .el-aside {
     background-color: #D3DCE6;
     color: #333;
     text-align: center;
     line-height: 200px;
   }

  .el-main {
     background-color: #E9EEF3;
     color: #333;
     text-align: center;
     line-height: 60px;
   }
</style>
